﻿@{
    Layout = Constants.AdminLayoutName;
    Title = "Create New Module";
    SubTitle = "Modules";
}

<link href="/Core.Cms/css/page.css" rel="stylesheet" />
<script src="/Core.Cms/js/manageModule.js"></script>

<div class="row">
    <ul class="nav nav-tabs">
        <li class="active">
            <a href="#site" data-toggle="tab" aria-expanded="true"> </a>
        </li>
        <li class="">
            <a href="#download" data-toggle="tab"> </a>
        </li>
    </ul>
    <div class="tab-content fullHeight widget-layout-container">
        <div class="tab-pane active" id="site">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        @SubTitle
                        <div class="pull-right"><a asp-controller="CmsTheme" asp-action="Install" class="btn btn-outline btn-primary btn-xs">Add New</a></div>
                    </div>
                    <div class="panel-body">
                        @if (@TempData.Keys.Contains("ModuleSuccessMessage"))
                        {
                            <div class="alert alert-success alert-dismissable">
                                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                                @TempData["ModuleSuccessMessage"] - <a href="/Home/RestartHost">Restart Now</a> <a href="#" class="alert-link"></a>.
                            </div>
                        }
                        <table id="pageListDt" class="table table-striped table-bordered" cellspacing="0" width="100%">
                            <thead>
                                <tr><th>Name</th><th>Author</th><th>Description</th><th>Version</th><th>Category</th><th>Preview</th><th>Action</th></tr>
                            </thead>
                            <tbody>
                                @foreach (var theme in ViewBag.Modules)
                                {
                                    <tr>
                                        <td>@theme.ThemeName</td>
                                        <td>@theme.Author</td>
                                        <td>@theme.Description</td>
                                        <td>@theme.Version</td>
                                        <td>@theme.Category</td>
                                        <td></td>
                                        <td>
                                            @if (theme.IsActive == false)
                                            {
                                                <a asp-controller="CmsTheme" asp-action="Activate" asp-route-themeId="@theme.ThemeId">Activate</a>
                                            }
                                            else
                                            {
                                                <span>Activated</span>
                                            }
                                        </td>
                                    </tr>
                                }
                            </tbody>
                        </table>

                    </div>
                    <!-- /.panel-body -->
                </div>
            </div>
        </div>
        <div class="tab-pane active" id="download">
            <div class="col-md-12">

            </div>
        </div>
    </div>
</div>

@section Scripts{
    <link href="~/lib/DataTables/dataTables.bootstrap.css" rel="stylesheet" />
    <link href="~/lib/DataTables/jquery.dataTables.min.css" rel="stylesheet" />
    <script src="~/lib/DataTables/jquery.dataTables.min.js"></script>
    <script src="~/lib/DataTables/dataTables.bootstrap.min.js"></script>
}
